#define _CRT_SECURE_NO_WARNINGS 1


#include<string>
#include<iostream>

using namespace std;

int lengthOfLongestSubstring(string s)
{
    int arr[129] = { 0 };
    int size = s.size();
    int left = 0, right = 0;
    int Max = 0;
    while (right < size)
    {
        arr[s[right]]++;
        while (arr[s[right]] > 1)
        {
            arr[s[left++]]--;
        }
        Max = max(Max, right - left + 1);
        right++;
    }
    return Max;
}